package com.aids_malaria.db.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.aids_malaria.http.response.PadMaxIdentitySeq;

import java.util.List;

@Dao
public interface PadMaxIdentitySeqDao {
    @Query("delete from padMaxIdentitySeq")
    int deleteAll();

    @Query("SELECT * FROM padMaxIdentitySeq")
    List<PadMaxIdentitySeq> getAll();

    @Query("SELECT * FROM padMaxIdentitySeq WHERE identity_subfield ==:identity_subfield AND sex ==:sex")
    List<PadMaxIdentitySeq> getByCodeAndSex(String identity_subfield, String sex);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    List<Long> insertAll(List<PadMaxIdentitySeq> users);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Long insert(PadMaxIdentitySeq padMaxIdentitySeq);

    @Update()
    int update(PadMaxIdentitySeq user);

}
